package br.edu.ufcg.dsc.sig.geointerest.gui.server;

import java.util.List;

import br.edu.ufcg.dsc.sig.geointerest.gui.client.GeoInterestServer;
import br.edu.ufcg.dsc.sig.geointerest.gui.client.POI;
import br.edu.ufcg.dsc.sig.geointerest.gui.client.QueryObject;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class GeoInterestServerImpl extends RemoteServiceServlet implements
		GeoInterestServer {

	public String greetServer(String input) {
		String serverInfo = getServletContext().getServerInfo();
		String userAgent = getThreadLocalRequest().getHeader("User-Agent");
		return "Hello, " + input + "!<br><br>I am running " + serverInfo
				+ ".<br><br>It looks like you are using:<br>" + userAgent;
	}

	@Override
	public POI addPOI(POI poi) {
		System.out.println("GeoInterestServerImpl.addPOI(): " + poi);
		return null;
	}

	@Override
	public List<POI> avaliar(QueryObject objetoConsulta) {
		System.out.println("GeoInterestServerImpl.avaliar()");
		return null;
	}

	@Override
	public void darAvaliacao(String poiId, String dono, String comentario,
			double nota) {
		System.out.println("GeoInterestServerImpl.darAvaliacao(): " + poiId + " "+ dono + " " + comentario);
	}

	@Override
	public void editPOI(POI poi) {
		System.out.println("GeoInterestServerImpl.editPOI(): " + poi);
	}

	@Override
	public List<POI> getAllPOIs() {
		System.out.println("GeoInterestServerImpl.getAllPOIs()");
		return null;
	}

	@Override
	public void removePOI(String id) {
		System.out.println("GeoInterestServerImpl.removePOI(): " + id);
	}
}
